package com.liujit.bms.app.controller;

import com.liujit.bms.app.domain.query.BlogMemberReadRecordQuery;
import com.liujit.bms.app.domain.result.BlogMemberReadRecordResult;
import com.liujit.bms.app.service.BlogMemberReadRecordService;
import com.liujit.common.domain.params.BaseParams;
import com.liujit.common.domain.result.PageBean;
import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @Description 博客会员阅读记录管理接口
 * @Author liujun
 * @Date 2021-07-16 18:15:24
 */
@RequiredArgsConstructor
@Api(tags = "博客会员阅读记录管理接口")
@RestController
@RequestMapping("/blog/member/read/record")
public class BlogMemberReadRecordController {

    private final BlogMemberReadRecordService blogMemberReadRecordService;

    @ApiOperation(value = "分页查询", notes = "根据博客会员阅读记录分页查询条件，分页查询博客会员阅读记录列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "query", value = "博客会员阅读记录分页查询条件", dataType = "BlogMemberReadRecordQuery", dataTypeClass = BlogMemberReadRecordQuery.class, paramType = "query") })
    @GetMapping("/getPage")
    public PageBean<BlogMemberReadRecordResult> getPage(BlogMemberReadRecordQuery query) {
        return blogMemberReadRecordService.getPage(query);
    }

    @ApiOperation(value = "删除", notes = "根据博客会员阅读记录删除请求参数，删除博客会员阅读记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "params", value = "博客会员阅读记录删除请求参数", dataType = "BaseParams", dataTypeClass = BaseParams.class, paramType = "body") })
    @PostMapping("/del")
    public Boolean del(@RequestBody BaseParams params) {
        return blogMemberReadRecordService.del(params);
    }

    @ApiOperation(value = "清空", notes = "清空博客会员阅读记录")
    @PostMapping("/clear")
    public Boolean clear() {
        return blogMemberReadRecordService.clear();
    }
}
